
//声明一个自定义指令,用于按钮鉴权

let vHas = {
    mounted(el, binding) {
        //获取存储在本地的用户权限
        let user = localStorage.getItem('user');
        if (user) {
            let { permissButtons } = JSON.parse(user);
            // ['read', 'delete',add']
            //判断用户是否具备对应按钮的权限字段
            let isHas = permissButtons.includes(binding.arg)

            if (!isHas) {
                //角色不存在对应按钮权限
                el.parentNode.removeChild(el)
            }

            // console.log(binding.arg)
        }
    }
}

export default vHas